This repository was archived by the owner on May 17, 2019. It is now read-only.
Add a tree shaking test that involves the use of Flow types#771
Open
alxmyth wants to merge 1 commit intofusionjs:masterfrom
alxmyth:tree-shake-flow-import-types
Open
Add a tree shaking test that involves the use of Flow types#771alxmyth wants to merge 1 commit intofusionjs:masterfrom alxmyth:tree-shake-flow-import-types
alxmyth wants to merge 1 commit intofusionjs:masterfrom
alxmyth:tree-shake-flow-import-types
Conversation
alxmyth
commented
May 6, 2019
|
|
||
| // used in the browser | ||
| // - node modules | ||
| const usedDepVal: UsedDependencyType = { shouldBeUsed: usedDependencyValue}; |
Member
Author
There was a problem hiding this comment.
Lines 51-52 here cause the vendor bundle to leak the unused import from fixture-pckg (__FIXTURE_DEPENDENCY_UNUSED__ which should be used only in the server bundle):
/*! no static exports found */function(e,o,s){"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.usedDependencyValue="__FIXTURE_DEPENDENCY_USED__",o.unusedDependencyValue="__FIXTURE_DEPENDENCY_UNUSED__"}}]);Removing these two lines tree shakes the import for fixture-pckg.
alxmyth
commented
May 6, 2019
| @@ -0,0 +1,11 @@ | |||
| 'use strict'; | |||
Member
Author
There was a problem hiding this comment.
We couldn't have export type declarations in the dependency's entry point, so maybe this test isn't the best...
Currently using the transpiled index.js here and added an index.js.flow file for Flow/IDE integration.
Member
Author
|
I was having trouble reproducing whether code was leaking into the browser due to Flow imports: e.g. import type {AType} from ... // no leak
import {B} from ...vs. import {type AType, B} from ... // potential leakNot entirely sure why, but tree splitting seems to be failing for node module dependency imports as a separate concern. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As part of the investigation into looking into WPT-2994 this PR adds a new test to ensure that
imports/exportsthat include Flow types are properly stripped and tree shaken.